﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Linq.Expressions;

namespace CodeC.Infrastructure.ViewModelBase
{

    /// <summary>
    /// This is the base class for all the viewModel classes, it has common properties and functions of viewModel.
    /// </summary>
    public class ViewModelBase : INotifyPropertyChanged
    {

        #region "Variables & Properties"
        public event PropertyChangedEventHandler PropertyChanged;
        
        #endregion

        #region "ctor"

        public void OnPropertyChanged<T>(Expression<Func<T>> expression)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(((MemberExpression)expression.Body).Member.Name));
            }
        }

        #endregion

    }

}
